﻿using CleanArchitecture.Core.Helper;
using FluentValidation.Validators;

namespace CleanArchitecture.Web.Validators
{
    /// <summary>
    /// Mobile validator
    /// </summary>
    public class MobileValidator : PropertyValidator
    {
        /// <summary>
        /// Ctor
        /// </summary>
        public MobileValidator()
            : base(ValidatorRuleString.MobileNumNotValid)
        {
            
        }

        /// <summary>
        /// Is valid?
        /// </summary>
        /// <param name="context">Validation context</param>
        /// <returns>Result</returns>
        protected override bool IsValid(PropertyValidatorContext context)
        {
            return CommonHelper.IsValidMobile(context.PropertyValue as string);
        }

    }
}
